﻿using StrategyPattern.Caculation;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace StrategyPattern
{
    internal class SimpleFactory
    {
        //简单工厂得到运算结果，策略执行的对象
        public static BaseCaculation CreateCaculation(string operate)
        {
            BaseCaculation caculation = null;
            switch (operate)
            {
                case "+":
                    caculation = new Plus();
                    break;
                case "-":
                    caculation = new Minus();
                    break;
                case "*":
                    caculation = new Multipy();
                    break;
                case "/":
                    caculation = new Division();
                    break;
                default:
                    break;
            }
            return caculation;
        }
    }
}
